<template>
	<view class="content">
		<text class="title">子组件A</text>
		<view class="value-box">
			<text>父组件传进来的值：</text>
			<text class="red-text">{{intent}}</text>
		</view>
		<button class="send-btn" type="primary" @click="sendData()">传值给CompB组件</button>
	</view>
</template>

<script>
	export default {
		props: ['intent'],
		name: "comA",
		data() {
			return {};
		},
		methods: {
			sendData() {
				console.warn("--comA---sendData---->"+this.intent);
				uni.$emit('getIntent',this.intent);
			}
		}
	}
</script>

<style>
	.content {
		background-color: #fbbc60;
		padding: 20rpx;
		width: 600rpx;
		margin: 0 auto;
		margin-bottom: 50rpx;
	}

	.title {
		font-size: 50rpx;
		display: block;
		text-align: center;
		margin-bottom: 30rpx;
		font-weight: bold;
	}

	.value-box {
		margin-bottom: 40rpx;
	}

	.red-text {
		font-weight: bold;
		color: red;
	}

	.send-btn {
		width: 400rpx;
		margin: 0 auto;
		margin-bottom: 20rpx;
	}
</style>